﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Data.SqlClient;

namespace CPAIS.Web.DbAccessors
{
    public class SQLServerAccessor : CPAIS.DbAccessor.IDbAccessor
    {
        /// <summary>
        /// Gets SQL Server connection string.
        /// </summary>
        public string ConnectionString
        {
            get
            { 
                return ConfigurationManager.ConnectionStrings[Constants.CPAISSQLServer].ConnectionString;
            }
        }

        public System.Data.Common.DbConnection CreateConnection()
        {
            return new SqlConnection(ConnectionString);
        }

        public System.Data.Common.DbCommand CreateCommand()
        {
            return new SqlCommand();
        }

        public System.Data.Common.DbDataAdapter CreateDataAdapter(System.Data.Common.DbCommand cmd)
        {
            return new SqlDataAdapter(cmd as SqlCommand);
        }
    }
}